home *** CD-ROM | disk | FTP | other *** search
/ Trusted Irix /B 4.0.4 / Trusted-Irix B-4.0.1.iso / dist / eoe1.idb / usr / lib / lib.b.z / lib.b
Text File  |  1992-04-03  |  2KB  |  155 lines

  1. scale = 20
  2. define e(x){
  3.     auto a, b, c, d, e, g
  4.     a=1
  5.     b=10
  6.     c=b
  7.     d=1
  8.     e=1
  9.     for(a=1;1==1;a++){
  10.         b=b*x
  11.         c=c*a+b
  12.         d=d*a
  13.         g = c/d
  14.         if(g == e) return(g/10)
  15.         e=g
  16.     }
  17. }
  18. scale = 20
  19. define s(x){
  20.     auto a, b, c, d, e, g, y
  21.     y = -x*x
  22.     a=1
  23.     b=x
  24.     c=b
  25.     d=1
  26.     e=1
  27.     for(a=3;1==1;a=a+2){
  28.         b=b*y
  29.         c=c*a*(a-1) + b
  30.         d=d*a*(a-1)
  31.         g=c/d
  32.         if(g==e) return(g)
  33.         e=g
  34.     }
  35. }
  36. scale = 20
  37. define c(x){
  38.     auto a, b, c, d, e, g, y
  39.     y = -x*x
  40.     a=1
  41.     b=1
  42.     c=b
  43.     d=1
  44.     e=1
  45.     for(a=2;1==1;a=a+2){
  46.         b=b*y
  47.         c=c*a*(a-1) + b
  48.         d=d*a*(a-1)
  49.         g=c/d
  50.         if(g==e) return(g)
  51.         e=g
  52.     }
  53. }
  54. scale = 20
  55. define l(x){
  56.     auto a, b, c, d, e, f, g, u, s, t
  57.     if(x <=0) return(1-10^scale)
  58.     t = scale
  59.     scale = 0
  60.     f = 1
  61.     s = x
  62.     while(s > 0){
  63.         s = s/10
  64.         f = f + 1
  65.     }
  66.     scale = t + f
  67.     f=1
  68.     while(x > 2){
  69.         x = sqrt(x)
  70.         f=f*2
  71.     }
  72.     while(x < .5){
  73.         x = sqrt(x)
  74.         f=f*2
  75.     }
  76.     u = (x-1)/(x+1)
  77.     s = u*u
  78.     b = 2*f
  79.     c = b
  80.     d = 1
  81.     e = 1
  82.     for(a=3;1==1;a=a+2){
  83.         b=b*s
  84.         c=c*a+d*b
  85.         d=d*a
  86.         g=c/d
  87.         if(g==e){
  88.             scale = t
  89.             return(u*c/d)
  90.         }
  91.         e=g
  92.     }
  93. }
  94. scale = 20
  95. define a(x){
  96.     auto a, b, c, d, e, f, g, s, t
  97.     if(x==0) return(0)
  98.     t = scale
  99.     f=1
  100.     while(x > .5){
  101.         scale = scale + 1
  102.         x= -(1-sqrt(1.+x*x))/x
  103.         f=f*2
  104.     }
  105.     while(x < -.5){
  106.         scale = scale + 1
  107.         x = -(1-sqrt(1.+x*x))/x
  108.         f=f*2
  109.     }
  110.     s = -x*x
  111.     b = f
  112.     c = f
  113.     d = 1
  114.     e = 1
  115.     for(a=3;1==1;a=a+2){
  116.         b=b*s
  117.         c=c*a+d*b
  118.         d=d*a
  119.         g=c/d
  120.         if(g==e){
  121.             scale = t
  122.             return(x*c/d)
  123.         }
  124.         e=g
  125.     }
  126. }
  127. scale = 20
  128. define j(n,x){
  129. auto a,b,c,d,e,g,i,s
  130. s= -x*x/4
  131. if(n<0){
  132.     n= -n
  133.     x= -x
  134.     }
  135. a=1
  136. c=1
  137. for(i=1;i<=n;i++){
  138.     a=a*x
  139.     c = c*2*i
  140.     }
  141. b=a
  142. d=1
  143. e=1
  144. for(i=1;1;i++){
  145.     a=a*s
  146.     b=b*i*(n+i) + a
  147.     c=c*i*(n+i)
  148.     g=b/c
  149.     if(g==e){
  150.         return(g)
  151.         }
  152.     e=g
  153.     }
  154. }
  155.